<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="com.tomato.bean.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>E_book DataStore</title>
<body>
	<form action="e_book?method=upload" method="post" enctype="multipart/form-data">
		<table width="600">
			<tr>
				<td width="20%">Book Title</td>
				<td width="80%"><input type="text" name="title" size="52" /></td>
			</tr>
			<tr>
				<td width="20%">Book Author</td>
				<td width="80%"><input type="text" name="author" size="52" /></td>
			</tr>	
			<tr>
				<td width="20%">Book Genre</td>
				<td width="80%">
					<select name="genre">
						<option value="fiction">Fiction</option>
						<option value="comics">Comics</option>
						<option value="magazine">Magazine</option>
						<option value="business">Business</option>
						<option value="newspaper">Newspaper</option>					
					</select>
				</td>
			</tr>	
			<tr>
				<td width="20%">Book Description</td>
				<td width="80%"><textarea name="description" rows="2" cols="40"></textarea></td>
			</tr>	
			<tr>
				<td width="20%">Book File</td>
				<td width="80%"><input type="file" name="ebook" size="52" /></td>
			</tr>		
		</table>
		<input type="submit" value="upload"/>
		
	</form>
	<table class="data-list" width="600" cellspacing="0" cellpadding="0">
				<%
				request.setCharacterEncoding("utf-8");
				List<Object[]> ebookList = (List<Object[]>)request.getAttribute("ebookList");
				if(ebookList.size() != 0){
					int i=1;
					for(Object[] ebook : ebookList){
				%>
					<tr>
						<td width="10%"><%=i++%></td>
						<td width="30%"><a href="e_book?method=show&id=<%=ebook[0].toString()%>" target="_blank" title="view"><%=ebook[1].toString()%></a></td>
						<td width="20%"><a href="e_book?method=xml">View</a></td>
						<td width="20%"><a href="e_book?method=edit&id=<%=ebook[0].toString()%>">Edit</a></td>
						<td width="20%"><a href="e_book?method=delete&id=<%=ebook[0].toString()%>">Delete</a></td>
					</tr>
				<%
				}
		}else{
			%>
			<tr>
				<td>the photo list is null</td>
			</tr>
			<%
		}
	%>
	</table>
</body>
</html>